package io.jpress.addon.partnershipauthorities.directive;

import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;
import com.jfinal.core.JFinal;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.template.Env;
import com.jfinal.template.io.Writer;
import com.jfinal.template.stat.Scope;
import io.jboot.web.controller.JbootControllerContext;
import io.jboot.web.directive.annotation.JFinalDirective;
import io.jboot.web.directive.base.JbootDirectiveBase;
import io.jboot.web.directive.base.PaginateDirectiveBase;
import io.jpress.JPressOptions;
import io.jpress.addon.partnershipauthorities.model.JpressAddonPartnershipauthorities;
import io.jpress.addon.partnershipauthorities.service.JpressAddonPartnershipauthoritiesService;
import io.jpress.commons.directive.DirectveKit;

import javax.servlet.http.HttpServletRequest;


@JFinalDirective("partnershipauthorities")
public class PartnershipauthoritiesDirective extends JbootDirectiveBase {

    @Inject
    JpressAddonPartnershipauthoritiesService service;

    @Override
    public void onRender(Env env, Scope scope, Writer writer) {

        Integer id = getParaToInt("id", scope);
        JpressAddonPartnershipauthorities jpressAddonPartnershipauthorities = service.findById(id);
        scope.setLocal("partnershipauthorities",jpressAddonPartnershipauthorities);
        renderBody(env, scope, writer);
    }

    @Override
    public boolean hasEnd() {
        return true;
    }
}
